//
//  ZH_PartnerRecodeTableViewCell.m
//  BuyProvince
//
//  Created by zhangliwen on 2018/7/19.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_PartnerRecodeTableViewCell.h"
@interface ZH_PartnerRecodeTableViewCell()
@property (nonatomic,weak)UILabel *nameLabel;
@property (nonatomic,weak)UILabel *timeLabel;
@property (nonatomic,weak)UILabel *moneyLabel;
@end
@implementation ZH_PartnerRecodeTableViewCell

+(instancetype)cellWithTableView:(UITableView*)tableView
{
    static NSString *ID = @"ZH_PartnerRecodeTableViewCell";
    ZH_PartnerRecodeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(cell == nil){
        cell = [[ZH_PartnerRecodeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}
- (void)initDefault{
    [self unShowClickEffect];
    self.topLongLineImage.hidden = NO;
    self.bottomLongLineImage.hidden = NO;
}
- (void)loadSubviewConstraints{
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(FITSCALE(15));
        make.left.equalTo(self.contentView).offset(FITSCALE(12));
    }];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLabel.mas_bottom).offset(FITSCALE(11));
        make.left.equalTo(self.nameLabel);
        make.bottom.equalTo(self.contentView).offset(FITSCALE(-10));
    }];
    [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(FITSCALE(17));
        make.right.equalTo(self.contentView).offset(FITSCALE(-12));
    }];
}
- (void)updataUI:(NSDictionary *)data{
    if (data) {
        NSString *string = [NSString stringWithFormat:@"%@",data[@"status"]];
        if ([string isEqualToString:@"1"]) {
            self.nameLabel.text = @"审核中";
        }
        else if ([string isEqualToString:@"2"]){
            self.nameLabel.text = @"申请成功";
        }
        else if ([string isEqualToString:@"3"]){
            self.nameLabel.text = @"申请失败";
        }
        self.timeLabel.text = [NSString stringWithFormat:@"%@",data[@"create_at"]];
        self.moneyLabel.text = [NSString stringWithFormat:@"-%@",data[@"money"]];
    }
}
- (void)updatasUI:(NSDictionary *)data{
    if (data) {
        self.nameLabel.text = data[@"content"];
        self.timeLabel.text = [NSString stringWithFormat:@"%@",data[@"create_time"]];
        self.moneyLabel.text = [NSString stringWithFormat:@"-%@",data[@"money"]];
    }
}
#pragma mark - getter,setter
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        UILabel *label = [UILabel createLabelWithText:@"提现" font:kFontSize_28];
        [self.contentView addSubview:_nameLabel = label];
    }
    return _nameLabel;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        UILabel *label = [UILabel createLabelWithText:@"2018-08-30 14:46" font:kFontSize_26];
        label.textColor = [UIColor colorWithHexString:@"#828282"];
        [self.contentView addSubview:_timeLabel = label];
    }
    return _timeLabel;
}
- (UILabel *)moneyLabel{
    if (!_moneyLabel) {
        UILabel *label = [UILabel createLabelWithText:@"-100" font:kFontSize_30];
        label.textColor = kFontColorRed;
        label.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_moneyLabel = label];
    }
    return _moneyLabel;
}
@end
